package com.mcy.gles.mesh.cube;

import android.app.Activity;
import android.opengl.GLSurfaceView;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;

public class CubeActivity extends Activity {

	CubeRenderer mCubeRenderer;
	boolean mCubeWait = false;
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		GLSurfaceView GLView = new GLSurfaceView(this); //创建一个GLSurfaceView
	    mCubeRenderer = new CubeRenderer();
		GLView.setRenderer(mCubeRenderer);
		setContentView(GLView);
		
		GLView.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				if(mCubeWait){
					mCubeRenderer.startRotation();
				}else{
					mCubeRenderer.stopRotation();
				}
				mCubeWait = !mCubeWait;
			}
		});
		
	}
}